package com.itheima.io.bufferedwriter.demo04;

import java.io.*;

public class CopyFileDemo01 {

    public static void main(String[] args) throws IOException {

        BufferedReader br = new BufferedReader(new FileReader("itheima-io-bufferedwriter\\c.txt"));
        BufferedWriter bw = new BufferedWriter(new FileWriter("E:\\d.txt"));

        //一次读取一个字符
//        int ch = -1;
//        while ((ch = br.read()) != -1) {
//            bw.write(ch);
//        }

        //一次读取一个字符数组
//        char[] chs = new char[1024];
//        int len = -1;
//        while ((len = br.read(chs)) != -1) {
//            bw.write(chs, 0, len);
//        }

        //一次读取一行
        String line = null;
        while ((line = br.readLine()) != null) {
            bw.write(line);
            bw.newLine();
            bw.flush();
        }

        bw.close();
        br.close();



    }

}
